package com.huawei.appmarket.framework.entry;

import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.IBinder;
import o.dhc;
import o.dhf;
import o.Logger;
import o.dqy;
import o.epp;
import o.eqp;
import o.ett;

public class EntranceService extends Service {
    private final dhc ˏ = new dhc();

    public void onCreate() {
        super.onCreate();
        Logger.ॱ(dqy.ˎ());
        Logger.ˏ(epp.ˊ(this), "HiAppEntry", "appstoreEx.txt");
        ett.ˏ().ॱ("EntranceService");
    }

    public IBinder onBind(Intent intent) {
        Logger.ˎ("EntranceService", "onBind");
        new dhf(getApplicationContext()).execute(new Void[0]);
        return this.ˏ;
    }

    public boolean onUnbind(Intent intent) {
        Logger.ˎ("EntranceService", "onUnbind");
        return super.onUnbind(intent);
    }

    public void onDestroy() {
        Logger.ˎ("EntranceService", "onDestroy");
        super.onDestroy();
        checkEntranceServiceValid(getApplicationContext());
    }

    public static void checkEntranceServiceValid(Context context) {
        int i;
        PackageManager packageManager = context.getPackageManager();
        boolean ॱॱ = eqp.ॱॱ();
        ComponentName componentName = new ComponentName(context, EntranceService.class);
        if (ॱॱ) {
            i = 2;
        } else {
            i = 1;
        }
        packageManager.setComponentEnabledSetting(componentName, i, 1);
    }
}
